package dao

import (
	"gin-ranking/api/lock/entity"
	"gin-ranking/common/result"
	"gin-ranking/pkg/db"
)

type LockPrivateDao struct{}

// QueryById 根据主键查询
func (LockPrivateDao) QueryById(id string) (lockPrivate entity.LockPrivate) {
	//err := db.DB.Model(&entity.LockPrivate{}).Select("*").Where("lockid = ?", id).Find(&lockPrivate).Error
	err := db.DB.Find(entity.LockPrivate{LockId: id}).First(&lockPrivate).Error
	if err != nil {
		panic(result.FailMag(err.Error()))
	}
	return lockPrivate
}
